{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--操作框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item demoTable">
                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" id="key" class="layui-input search" name="key" value="" placeholder="积分消费内容"/>
                        </div>
                        <div class="layui-input-inline" style="display: flex;">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                            <button class="layui-btn layui-btn-primary" onclick="history.go(-1)" >返回</button>
                        </div>

                    </div>
                </div>
                <!--操作框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    var user_id = "{$user_id}";
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
            , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("member/memberDetail")}?user_id='+user_id
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type:'numbers', width: 80, title: '序号'}
                , {field: 'user_username', width: '', title: '用户名', align: 'center'}
                , {field: 'consume_content', width: '', title: '积分消费记录', align: 'center'}
                , {field: 'consume_add_time', width: '', title: '消费时间', align: 'center'}
            ]]
        });

        搜索
        var $ = layui.$, active = {
            reload: function(){
                var demoReload = $('#demoReload');

                table.reload('test', {
                    where: {
                        keyz: demoReload.val(),
                    }
                });
            }
        };
        $('.demoTable .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
</script>
</body>
</html>